﻿<section class="container-fluid" style="background-color: white;">
    <form class="form-horizontal m15_t" id="form">
        <div class="tab-content">
            <div class="tab-pane fade in active" id="home">
                
                <div class="form-group">
                    <label class="wd100 control-label"><span class="WdateFmtErr">*</span>料号</label>
                    <div class="wd400 m15_l">
                        <input class="form-control" type="text" name="partNo" maxlength="40" autocomplete="off" placeholder="">
                    </div>
                </div>
                <div class="form-group">
                    <label class="wd100 control-label"><span class="WdateFmtErr">*</span>物件名称</label>
                    <div class="wd400 m15_l">
                        <input class="form-control" type="text" name="productName" maxlength="40" autocomplete="off" placeholder="">
                    </div>
                </div>
                <div class="form-group">
                    <label class="wd100 control-label"><span class="WdateFmtErr">*</span>数量：</label>
                    <div class="wd400 m15_l">
                        <input class="form-control" type="text" name="quantity" maxlength="40" autocomplete="off" placeholder="">
                    </div>
                </div>
                <div class="form-group">
                    <label class="wd100 control-label"><span class="WdateFmtErr">*</span>批号</label>
                    <div class="wd400 m15_l">
                        <input class="form-control" type="text" name="lotNo" maxlength="40" autocomplete="off" placeholder="">
                    </div>
                </div>
                <div class="form-group">
                    <label class="wd100 control-label">等级</label>
                    <div class="wd400 m15_l">
                        <input class="form-control" type="text" name="grade" maxlength="40" autocomplete="off" placeholder="">
                    </div>
                </div>
            </div>
        </div>
    </form>
</section>
@section footerScript{
    <script type="text/javascript">

        function save() {
            var obj = {};
            //物料名称
            obj.ProductName = $("input[name='productName']").val();

            if (Topro.Util.isNullOrEmptySpance(obj.ProductName)) {
                Topro.UI.Tip_danger("物件编号不能为空.")
                return false;
            }
            //物料数量
            obj.Quantity = $("input[name='quantity']").val();

            if (Topro.Util.isNullOrEmptySpance(obj.Quantity)) {
                Topro.UI.Tip_danger("物料数量不能为空.")
                return false;
            }

            var reg = /^(\-|\+)?\d+(\.\d+)?$/;
            if (!(reg.test(obj.Quantity))) {
                Topro.UI.Tip_danger("物料数量只能为正整数.")
                return false;

            }
            //批号
            obj.LotNo = $("input[name='lotNo']").val();

            if (Topro.Util.isNullOrEmptySpance(obj.LotNo)) {
                Topro.UI.Tip_danger("批号1不能为空.")
                return false;
            }

            //等级
            obj.Grade = $("input[name='grade']").val();

            /*
            var obj = {
                "ProductName": "材料名称",
                "Quantity": 10000,
                "LotNo1": "2022-1",
                "LotNo2": "2022-2",
            }
            */

            Topro.UI.DialogOpener().addInventoryItem(obj);
            Topro.UI.DialogOpener().Tip_success("操作成功！");
            Topro.UI.CloseDialog();
        }
    </script>
}